/**
 * Created by saber on 15/8/28.
 */

wcApp.controller('myRequestCtrl', ['$scope', '$state', 'ionicMaterialInk', 'ionicMaterialMotion','$http','$timeout','user','request','$location','$rootScope',
    function ($scope, $state, ionicMaterialInk, ionicMaterialMotion,$http,$timeout,user,request,$location,$rootScope) {

        function checkLogin() {

            if (!user.hasLogin()) {
                $state.go("app.main");
            } else {
                $scope.userdata = user.data();
            }
        }

        checkLogin();
        $rootScope.$on("$locationChangeStart", function (e, n, o, ns, os) {
            if ($location.path()=='/myRequest'){
                checkLogin();
            };
        })

        $scope.request=request;


        $scope.myreq=request;

        $timeout(function() {
            ionicMaterialMotion.slideUp({
                selector: '.slide-up'
            });
        }, 300);

        $timeout(function() {
            ionicMaterialMotion.fadeSlideInRight({
                startVelocity: 3000
            });
        }, 700);
        // Set Ink
        ionicMaterialInk.displayEffect();



        console.log($scope.userdata,"sss")


    }]);